import {
  pageKey,
  sectionKey,
  sectionSort,
  sectionInsert,
  sectionSelect,
  sectionUpdate,
  messageKey,
  messageUpdateKey,
  messageRegenerateKey,
  updateViewKey,
  sectionOperator,
  pageChangeKey,
  questionUpdateKey,
  chatResetUpdateKey,
  robotMessageKey,
  robotQuestionMessageKey,
  insightConfigMessageKey
} from '@/common/config/event-type';
import { useEventBus } from '@vueuse/core';

export function getEventBus() {

  // 页面事件总线
  const pageEventBus = useEventBus(pageKey);
  // 卡片事件总线
  const sectionEventBus = useEventBus(sectionKey);
  // 卡片排序事件总线
  const sectionSortEventBus = useEventBus(sectionSort);
  // 卡片插入事件总线
  const sectionInsertEventBus = useEventBus(sectionInsert);
  // 卡片选中事件总线
  const sectionSelectEventBus = useEventBus(sectionSelect);
  // 卡片更新事件总线
  const sectionUpdateEventBus = useEventBus(sectionUpdate);
  // 消息事件总线
  const messageEventBus = useEventBus(messageKey);
  // 消息更新事件总线
  const messageUpdateEventBus = useEventBus(messageUpdateKey);
  // 消息重新生成事件总线
  const messageRegenerateEventBus = useEventBus(messageRegenerateKey);
  // 更新页面视图消息
  const updateViewEventBus = useEventBus(updateViewKey);
  // 卡片操作事件总线
  const sectionOperatorEventBus = useEventBus(sectionOperator);
  // 页面切换事件总线
  const pageChangeEventBus = useEventBus(pageChangeKey);
  // 问句生成消息总线
  const questionUpdateEventBus = useEventBus(questionUpdateKey);
  // 清除上下文消息总线
  const chatResetEventBus = useEventBus(chatResetUpdateKey);
  // 机器人消息总线
  const robotMessageEventBus = useEventBus(robotMessageKey);
  // 机器人问句消息总线
  const robotQuestionEventBus = useEventBus(robotQuestionMessageKey);
  // 可视化洞察消息总线
  const insightConfigEventBus = useEventBus(insightConfigMessageKey)

  return {
    pageEventBus,
    sectionEventBus,
    sectionSortEventBus,
    sectionInsertEventBus,
    sectionSelectEventBus,
    sectionUpdateEventBus,
    messageEventBus,
    messageUpdateEventBus,
    messageRegenerateEventBus,
    updateViewEventBus,
    sectionOperatorEventBus,
    pageChangeEventBus,
    questionUpdateEventBus,
    chatResetEventBus,
    robotMessageEventBus,
    robotQuestionEventBus,
    insightConfigEventBus
  }
}